<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
        <meta name="format-detection" content="telephone=no"/>
		<meta name="format-detection" content="email=no">
		<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
		<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> 
		<meta HTTP-EQUIV="Expires" CONTENT="0"> 
		<title>欢迎页</title>
		<link rel="stylesheet" type="text/css" href="../common/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="css/welcome.css"/>
		<style type="text/css">
			.box {
  position: relative;
  width: 100px;
  height: 100px;
}
#launch-btn {
  position: absolute; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;  
  z-index: 9;
  overflow: hidden;
}
		</style>
	</head>
	<body>
		<div class="w_main">
			<img src="img/welcome/top.png" class="w_top"/>
			<img src="img/welcome/word.png" class="w_title"/>
			<img src="img/welcome/pic.png" class="w_img"/>
			
			<div class="w_link">
				<wx-open-launch-weapp id="launch-btn" username="gh_1275768357c8" path="pages/index/index.html" >
					<script type="text/wxtag-template">
						<style>.btn {background: #FFC121; color: #005BAC;font-size: 18px;border-radius: 25px;text-align: center;height: 50px;line-height: 50px;}
						
						</style>
						<div class="btn">立即加入</div>
					</script>
				</wx-open-launch-weapp>
			</div>				
			
			
		</div>
	</body>
</html>
<script src="/common/js/jquery-3.6.0.min.js"></script>
<script src="js/iconfont.js"></script>
<script src="https://res2.wx.qq.com/open/js/jweixin-1.6.0.js "></script>
<script>
	var param = {pageUrl:window.location.href}
	$.ajax({
		type:"post",
		url:AJAXURL+"/sys/wechat/signature",
		dataType: AJAXDATATYPE,
		contentType:AJAXCONTENTTYPE,
		data:JSON.stringify(param),
		success:function(data){
			console.log('ajax',data,window.location.href)
			var result = data.result
			wx.config({
				debug: false, // 调试时可开启
				appId: result.appId, // <!-- replace -->
				timestamp: result.timestamp, // 必填，填任意数字即可
				nonceStr: result.nonceStr, // 必填，填任意非空字符串即可
				signature: result.signature, // 必填，填任意非空字符串即可
				jsApiList: ['chooseImage', 'previewImage'], // 必填，随意一个接口即可 
				openTagList: ['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
			})
			wx.ready(function () {
			  // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready函数中
				var btn = document.getElementById('launch-btn');
				btn.addEventListener('launch', function(e) {
					console.log('success');
				});
				btn.addEventListener('error', function(e) {
					console.log('fail', e.detail);
				});
			});
			wx.error(function(res) {
				console.log('wx.error',res)
			  // config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名
			});
				}
			});
	
	
	
</script>